<template>
	<view>
		<template v-if="IsFontView">
			<view class="login-check-view1" :style="{width:width}">
				<view class="login-check-view" v-for="(item,index) in list" :key="index" @click="$emit('checkView',index)">
					<view class="login-check-title" :style="{color:color}">{{item.name}}</view>
					<view class="check-icon" v-if="checkIndex == index"></view>
				</view>
			</view>
		</template>
		<template v-else>
			<view class="tabs-box-view" :style="{width:width}">
				<view class="tabs-box-item"v-for="(item,index) in list" :key="index" 
				:class="checkIndex == index?'tabs-active':''"
				@click="$emit('checkView',index)">{{item.name}}</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		props:{
			list:Array,
			checkIndex:[String,Number],
			color:{
				type:String,
				default:'#FFF6DF'
			},
			IsFontView:Boolean,
			width:{
				type:String,
				default:'100%'
			}
		},
		data(){
			return{
				
			}
		},
		methods:{}
	}
</script>

<style lang="scss">
	// 盒子切换
	.tabs-box-view{
		display: flex;
		font-size: 14px;
		color: #333333;
		background-color: #E55E3B;
		border-radius: 10rpx;
		overflow: hidden;
	}
	.tabs-box-item{
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 20rpx;
	}
	.tabs-active{
		background-color: #FFF6DF;
	}
	// 字体切换
	.login-check-view1 {
		display: flex;
		align-items: center;
		justify-content: center;
	
		.login-check-view {
			// flex: 1;
			display: flex;
			align-items: center;
			position: relative;
	
			margin: 20rpx 20rpx 0px 20rpx;
	
			.login-check-title {
				font-size: 15px;
				// color: #FFF6DF;
			}
	
			.check-icon {
				position: absolute;
				bottom: -20rpx;
				left: 50%;
				transform: translate(-50%,-50%);
				width: 40rpx;
				height: 8rpx;
				background-color: #FFF6DF;
				border-radius: 10rpx;
			}
		}
	}
</style>